<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			/*
			  解构赋值:
			  1.数组解构赋值
			  2.对象解构赋值
			*/

			const arr1 = [1, 2, 3];

			// const [a, b, c] = arr1;

			// const [a, , c] = arr1;

			// const [a, b = 6, c] = [];

			// console.log(a);
			// console.log(b);
			// console.log(c);

			const stu = {
				name: "张三",
				age: 20
			}

			// const { a, b} = { a:6 };
			// console.log(a);
			// console.log(b);
			
			const {name,age,sex} = stu;
			console.log(name);
			
			/*
			   {
			       "code": 200,
			       "message": "成功!",
			       "result": {
			           "date": "2020-11-16",
			           "time": "15:41:00",
			           "weekday": "星期一",
			           "dateTime": "2020-11-16 15:41:00"
			       }
			   }
			   
			   var jsonObj = JSON.parse(jsonStr);
			   jsonObj.result.date
			   
			   const {result} = jsonObj;
			   result.date
			*/
		</script>
	</body>
</html>
